<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>我的微博列表</h1>
  <div v-for="weibo in arr">
      <h3>{{weibo.content}}</h3>
      <div>
          发布于{{weibo.created}}
          <a href="javascript:void(0)" @click="del(weibo.id)">删除</a>
      </div>
      <img v-for="url in weibo.urlArr" :src="url" style="width:200px;height: 200px" alt="">
      <hr>
  </div>
</div>
<script src="js/vue.min.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"body>div",
        data:{
            arr:[]
        },
        created:function (){
            axios.get("/self/select").then(function (response){
               v.arr = response.data;
               for(let weibo of v.arr){
                   weibo.urlArr = weibo.urls==""?[]:weibo.urls.split(",")
               }
            })
        },
        methods:{
            del(id){
                if(confirm("确定要删除吗?")){
                    axios.get("/delete?id="+id).then(function (response){
                        location.reload();
                    })
                }


            }
        }
    })
</script>
</body>
</html>